<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <a href="http://baidu.com"></a>
</body>
</html>
<script>
    //a标签和form标签具备跳转功能、
    // 阻止标签的跳转 调用event.preventDefault();
    document.querySelector('a').addEventListener('click',function(event){
        event.preventDefault();
        console.log(123);
    })
</script>